home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / include / dvdmedia.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  18KB  |  419 lines

  1. //------------------------------------------------------------------------------
  2. // File: DVDMedia.h
  3. //
  4. // Desc: Contains typedefs and defines necessary for user mode (ring 3) DVD
  5. //       filters and applications.
  6. //
  7. //       This should be included in the DirectShow SDK for user mode filters.
  8. //       The types defined here should be kept in synch with ksmedia.h WDM 
  9. //       DDK for kernel mode filters.
  10. //
  11. // Copyright (c) 1997 - 2001, Microsoft Corporation.  All rights reserved.
  12. //------------------------------------------------------------------------------
  13.  
  14.  
  15. #ifndef __DVDMEDIA_H__
  16. #define __DVDMEDIA_H__
  17.  
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif // __cplusplus
  21.  
  22. // -----------------------------------------------------------------------
  23. // AC-3 definition for the AM_KSPROPSETID_AC3 property set
  24. // -----------------------------------------------------------------------
  25.  
  26. typedef enum {
  27.     AM_PROPERTY_AC3_ERROR_CONCEALMENT = 1,
  28.     AM_PROPERTY_AC3_ALTERNATE_AUDIO = 2,
  29.     AM_PROPERTY_AC3_DOWNMIX = 3,
  30.     AM_PROPERTY_AC3_BIT_STREAM_MODE = 4,
  31.     AM_PROPERTY_AC3_DIALOGUE_LEVEL = 5,
  32.     AM_PROPERTY_AC3_LANGUAGE_CODE = 6,
  33.     AM_PROPERTY_AC3_ROOM_TYPE = 7
  34. } AM_PROPERTY_AC3;
  35.  
  36. typedef struct  {
  37.     BOOL        fRepeatPreviousBlock;
  38.     BOOL        fErrorInCurrentBlock;
  39. } AM_AC3_ERROR_CONCEALMENT, *PAM_AC3_ERROR_CONCEALMENT;
  40.  
  41. typedef struct {
  42.     BOOL    fStereo;
  43.     ULONG   DualMode;
  44. } AM_AC3_ALTERNATE_AUDIO, *PAM_AC3_ALTERNATE_AUDIO;
  45.  
  46. #define AM_AC3_ALTERNATE_AUDIO_1     1
  47. #define AM_AC3_ALTERNATE_AUDIO_2     2
  48. #define AM_AC3_ALTERNATE_AUDIO_BOTH  3
  49.  
  50. typedef struct {
  51.     BOOL        fDownMix;
  52.     BOOL        fDolbySurround;
  53. } AM_AC3_DOWNMIX, *PAM_AC3_DOWNMIX;
  54.  
  55. typedef struct {
  56.     LONG        BitStreamMode;
  57. } AM_AC3_BIT_STREAM_MODE, *PAM_AC3_BIT_STREAM_MODE;
  58.  
  59. #define AM_AC3_SERVICE_MAIN_AUDIO            0
  60. #define AM_AC3_SERVICE_NO_DIALOG             1
  61. #define AM_AC3_SERVICE_VISUALLY_IMPAIRED     2
  62. #define AM_AC3_SERVICE_HEARING_IMPAIRED      3
  63. #define AM_AC3_SERVICE_DIALOG_ONLY           4
  64. #define AM_AC3_SERVICE_COMMENTARY            5
  65. #define AM_AC3_SERVICE_EMERGENCY_FLASH       6
  66. #define AM_AC3_SERVICE_VOICE_OVER            7
  67.  
  68. typedef struct {
  69.     ULONG   DialogueLevel;
  70. } AM_AC3_DIALOGUE_LEVEL, *PAM_AC3_DIALOGUE_LEVEL;
  71.  
  72. typedef struct {
  73.     BOOL    fLargeRoom;
  74. } AM_AC3_ROOM_TYPE, *PAM_AC3_ROOM_TYPE;
  75.  
  76.  
  77. // -----------------------------------------------------------------------
  78. // subpicture definition for the AM_KSPROPSETID_DvdSubPic property set
  79. // -----------------------------------------------------------------------
  80.  
  81. typedef enum {
  82.     AM_PROPERTY_DVDSUBPIC_PALETTE = 0,
  83.     AM_PROPERTY_DVDSUBPIC_HLI = 1,
  84.     AM_PROPERTY_DVDSUBPIC_COMPOSIT_ON = 2  // TRUE for subpicture is displayed
  85. } AM_PROPERTY_DVDSUBPIC;
  86.  
  87. typedef struct _AM_DVD_YUV {
  88.     UCHAR   Reserved;
  89.     UCHAR   Y;
  90.     UCHAR   U;
  91.     UCHAR   V;
  92. } AM_DVD_YUV, *PAM_DVD_YUV;
  93.  
  94. typedef struct _AM_PROPERTY_SPPAL {
  95.     AM_DVD_YUV sppal[16];
  96. } AM_PROPERTY_SPPAL, *PAM_PROPERTY_SPPAL;
  97.  
  98. typedef struct _AM_COLCON {
  99.     UCHAR emph1col:4;
  100.     UCHAR emph2col:4;
  101.     UCHAR backcol:4;
  102.     UCHAR patcol:4;
  103.     UCHAR emph1con:4;
  104.     UCHAR emph2con:4;
  105.     UCHAR backcon:4;
  106.     UCHAR patcon:4;
  107.  
  108. } AM_COLCON, *PAM_COLCON;
  109.  
  110. typedef struct _AM_PROPERTY_SPHLI {
  111.     USHORT     HLISS;      //
  112.     USHORT     Reserved;
  113.     ULONG      StartPTM;   // start presentation time in x/90000
  114.     ULONG      EndPTM;     // end PTM in x/90000
  115.     USHORT     StartX;
  116.     USHORT     StartY;
  117.     USHORT     StopX;
  118.     USHORT     StopY;
  119.     AM_COLCON  ColCon;     // color contrast description (4 bytes as given in HLI)
  120. } AM_PROPERTY_SPHLI, *PAM_PROPERTY_SPHLI;
  121.  
  122. typedef BOOL AM_PROPERTY_COMPOSIT_ON, *PAM_PROPERTY_COMPOSIT_ON;
  123.  
  124.  
  125.  
  126. // -----------------------------------------------------------------------
  127. // copy protection definitions
  128. // -----------------------------------------------------------------------
  129.  
  130. // AM_UseNewCSSKey for the dwTypeSpecificFlags in IMediaSample2 to indicate
  131. // the exact point in a stream after which to start applying a new CSS key.
  132. // This is typically sent on an empty media sample just before attempting 
  133. // to renegotiate a CSS key.
  134. #define AM_UseNewCSSKey    0x1
  135.  
  136. //
  137. // AM_KSPROPSETID_CopyProt property set definitions
  138. //
  139. typedef enum {
  140.     AM_PROPERTY_DVDCOPY_CHLG_KEY = 0x01,
  141.     AM_PROPERTY_DVDCOPY_DVD_KEY1 = 0x02,
  142.     AM_PROPERTY_DVDCOPY_DEC_KEY2 = 0x03,
  143.     AM_PROPERTY_DVDCOPY_TITLE_KEY = 0x04,
  144.     AM_PROPERTY_COPY_MACROVISION = 0x05,
  145.     AM_PROPERTY_DVDCOPY_REGION = 0x06,
  146.     AM_PROPERTY_DVDCOPY_SET_COPY_STATE = 0x07,
  147.     AM_PROPERTY_DVDCOPY_DISC_KEY = 0x80
  148. } AM_PROPERTY_DVDCOPYPROT;
  149.  
  150. typedef struct _AM_DVDCOPY_CHLGKEY {
  151.     BYTE ChlgKey[10];
  152.     BYTE Reserved[2];
  153. } AM_DVDCOPY_CHLGKEY, *PAM_DVDCOPY_CHLGKEY;
  154.  
  155. typedef struct _AM_DVDCOPY_BUSKEY {
  156.     BYTE BusKey[5];
  157.     BYTE Reserved[1];
  158. } AM_DVDCOPY_BUSKEY, *PAM_DVDCOPY_BUSKEY;
  159.  
  160. typedef struct _AM_DVDCOPY_DISCKEY {
  161.     BYTE DiscKey[2048];
  162. } AM_DVDCOPY_DISCKEY, *PAM_DVDCOPY_DISCKEY;
  163.  
  164. typedef struct AM_DVDCOPY_TITLEKEY {
  165.     ULONG KeyFlags;
  166.     ULONG Reserved1[2];
  167.     UCHAR TitleKey[6];
  168.     UCHAR Reserved2[2];
  169. } AM_DVDCOPY_TITLEKEY, *PAM_DVDCOPY_TITLEKEY;
  170.  
  171. typedef struct _AM_COPY_MACROVISION {
  172.     ULONG MACROVISIONLevel;
  173. } AM_COPY_MACROVISION, *PAM_COPY_MACROVISION;
  174.  
  175. typedef struct AM_DVDCOPY_SET_COPY_STATE {
  176.     ULONG DVDCopyState;
  177. } AM_DVDCOPY_SET_COPY_STATE, *PAM_DVDCOPY_SET_COPY_STATE;
  178.  
  179. typedef enum {
  180.     AM_DVDCOPYSTATE_INITIALIZE = 0,
  181.     AM_DVDCOPYSTATE_INITIALIZE_TITLE = 1,   // indicates we are starting a title
  182.                                         // key copy protection sequence
  183.     AM_DVDCOPYSTATE_AUTHENTICATION_NOT_REQUIRED = 2,
  184.     AM_DVDCOPYSTATE_AUTHENTICATION_REQUIRED = 3,
  185.     AM_DVDCOPYSTATE_DONE = 4
  186. } AM_DVDCOPYSTATE;
  187.  
  188. typedef enum {
  189.     AM_MACROVISION_DISABLED = 0,
  190.     AM_MACROVISION_LEVEL1 = 1,
  191.     AM_MACROVISION_LEVEL2 = 2,
  192.     AM_MACROVISION_LEVEL3 = 3
  193. } AM_COPY_MACROVISION_LEVEL, *PAM_COPY_MACROVISION_LEVEL;
  194.  
  195.  
  196. // CSS region stucture
  197. typedef struct _DVD_REGION {
  198.     UCHAR CopySystem;
  199.     UCHAR RegionData;
  200.     UCHAR SystemRegion;
  201.     UCHAR Reserved;
  202. } DVD_REGION, *PDVD_REGION; 
  203.  
  204. //
  205. // CGMS Copy Protection Flags
  206. //
  207.  
  208. #define AM_DVD_CGMS_RESERVED_MASK      0x00000078
  209.  
  210. #define AM_DVD_CGMS_COPY_PROTECT_MASK  0x00000018
  211. #define AM_DVD_CGMS_COPY_PERMITTED     0x00000000
  212. #define AM_DVD_CGMS_COPY_ONCE          0x00000010
  213. #define AM_DVD_CGMS_NO_COPY            0x00000018
  214.  
  215. #define AM_DVD_COPYRIGHT_MASK          0x00000040
  216. #define AM_DVD_NOT_COPYRIGHTED         0x00000000
  217. #define AM_DVD_COPYRIGHTED             0x00000040
  218.  
  219. #define AM_DVD_SECTOR_PROTECT_MASK     0x00000020
  220. #define AM_DVD_SECTOR_NOT_PROTECTED    0x00000000
  221. #define AM_DVD_SECTOR_PROTECTED        0x00000020
  222.  
  223.  
  224. // -----------------------------------------------------------------------
  225. // video format blocks
  226. // -----------------------------------------------------------------------
  227.  
  228. enum AM_MPEG2Level {
  229.     AM_MPEG2Level_Low = 1,
  230.     AM_MPEG2Level_Main = 2,
  231.     AM_MPEG2Level_High1440 = 3,
  232.     AM_MPEG2Level_High = 4
  233. };
  234.  
  235. enum AM_MPEG2Profile {
  236.     AM_MPEG2Profile_Simple = 1,
  237.     AM_MPEG2Profile_Main = 2,
  238.     AM_MPEG2Profile_SNRScalable = 3,
  239.     AM_MPEG2Profile_SpatiallyScalable = 4,
  240.     AM_MPEG2Profile_High = 5
  241. };
  242.  
  243. #define AMINTERLACE_IsInterlaced            0x00000001  // if 0, other interlace bits are irrelevent
  244. #define AMINTERLACE_1FieldPerSample         0x00000002  // else 2 fields per media sample
  245. #define AMINTERLACE_Field1First             0x00000004  // else Field 2 is first;  top field in PAL is field 1, top field in NTSC is field 2?
  246. #define AMINTERLACE_UNUSED                  0x00000008  //
  247. #define AMINTERLACE_FieldPatternMask        0x00000030  // use this mask with AMINTERLACE_FieldPat*
  248. #define AMINTERLACE_FieldPatField1Only      0x00000000  // stream never contains a Field2
  249. #define AMINTERLACE_FieldPatField2Only      0x00000010  // stream never contains a Field1
  250. #define AMINTERLACE_FieldPatBothRegular     0x00000020  // There will be a Field2 for every Field1 (required for Weave?)
  251. #define AMINTERLACE_FieldPatBothIrregular   0x00000030  // Random pattern of Field1s and Field2s
  252. #define AMINTERLACE_DisplayModeMask         0x000000c0
  253. #define AMINTERLACE_DisplayModeBobOnly      0x00000000
  254. #define AMINTERLACE_DisplayModeWeaveOnly    0x00000040
  255. #define AMINTERLACE_DisplayModeBobOrWeave   0x00000080
  256.  
  257. #define AMCOPYPROTECT_RestrictDuplication   0x00000001  // duplication of this stream should be restricted
  258.  
  259. #define AMMPEG2_DoPanScan           0x00000001  //if set, the MPEG-2 video decoder should crop output image 
  260.                         //  based on pan-scan vectors in picture_display_extension 
  261.                         //  and change the picture aspect ratio accordingly.
  262. #define AMMPEG2_DVDLine21Field1     0x00000002  //if set, the MPEG-2 decoder must be able to produce an output 
  263.                         //  pin for DVD style closed caption data found in GOP layer of field 1
  264. #define AMMPEG2_DVDLine21Field2     0x00000004  //if set, the MPEG-2 decoder must be able to produce an output 
  265.                         //  pin for DVD style closed caption data found in GOP layer of field 2
  266. #define AMMPEG2_SourceIsLetterboxed 0x00000008  //if set, indicates that black bars have been encoded in the top 
  267.                         //  and bottom of the video.
  268. #define AMMPEG2_FilmCameraMode      0x00000010  //if set, indicates "film mode" used for 625/50 content.  If cleared,
  269.                         //  indicates that "camera mode" was used.
  270. #define AMMPEG2_LetterboxAnalogOut  0x00000020  //if set and this stream is sent to an analog output, it should 
  271.                         //  be letterboxed.  Streams sent to VGA should be letterboxed only by renderers.
  272. #define AMMPEG2_DSS_UserData        0x00000040  //if set, the MPEG-2 decoder must process DSS style user data
  273. #define AMMPEG2_DVB_UserData        0x00000080  //if set, the MPEG-2 decoder must process DVB style user data
  274. #define AMMPEG2_27MhzTimebase       0x00000100  //if set, the PTS,DTS timestamps advance at 27MHz rather than 90KHz
  275.  
  276. #define AMMPEG2_WidescreenAnalogOut 0x00000200  //if set and this stream is sent to an analog output, it should 
  277.                         //  be in widescreen format (4x3 content should be centered on a 16x9 output).
  278.                         //  Streams sent to VGA should be widescreened only by renderers.
  279.  
  280. // PRESENT in dwReserved1 field in VIDEOINFOHEADER2
  281. #define AMCONTROL_USED              0x00000001 // Used to test if these flags are supported.  Set and test for AcceptMediaType.
  282.                                                 // If rejected, then you cannot use the AMCONTROL flags (send 0 for dwReserved1) 
  283. #define AMCONTROL_PAD_TO_4x3        0x00000002 // if set means display the image in a 4x3 area 
  284. #define AMCONTROL_PAD_TO_16x9       0x00000004 // if set means display the image in a 16x9 area 
  285.  
  286. typedef struct tagVIDEOINFOHEADER2 {
  287.     RECT                rcSource;
  288.     RECT                rcTarget;
  289.     DWORD               dwBitRate;
  290.     DWORD               dwBitErrorRate;
  291.     REFERENCE_TIME      AvgTimePerFrame;
  292.     DWORD               dwInterlaceFlags;   // use AMINTERLACE_* defines. Reject connection if undefined bits are not 0
  293.     DWORD               dwCopyProtectFlags; // use AMCOPYPROTECT_* defines. Reject connection if undefined bits are not 0
  294.     DWORD               dwPictAspectRatioX; // X dimension of picture aspect ratio, e.g. 16 for 16x9 display 
  295.     DWORD               dwPictAspectRatioY; // Y dimension of picture aspect ratio, e.g.  9 for 16x9 display
  296.     union {
  297.         DWORD dwControlFlags;               // use AMCONTROL_* defines, use this from now on
  298.         DWORD dwReserved1;                  // for backward compatiblity (was "must be 0";  connection rejected otherwise)
  299.     };
  300.     DWORD               dwReserved2;        // must be 0; reject connection otherwise
  301.     BITMAPINFOHEADER    bmiHeader;
  302. } VIDEOINFOHEADER2;
  303.  
  304. typedef struct tagMPEG2VIDEOINFO {
  305.     VIDEOINFOHEADER2    hdr;
  306.     DWORD               dwStartTimeCode;        //  ?? not used for DVD ??
  307.     DWORD               cbSequenceHeader;       // is 0 for DVD (no sequence header)
  308.     DWORD               dwProfile;              // use enum MPEG2Profile   
  309.     DWORD               dwLevel;                // use enum MPEG2Level
  310.     DWORD               dwFlags;                // use AMMPEG2_* defines.  Reject connection if undefined bits are not 0
  311.     DWORD               dwSequenceHeader[1];    // DWORD instead of Byte for alignment purposes
  312.                                                 //   For MPEG-2, if a sequence_header is included, the sequence_extension 
  313.                                                 //   should also be included
  314. } MPEG2VIDEOINFO;
  315.  
  316. #define SIZE_MPEG2VIDEOINFO(pv) (FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader[0]) + (pv)->cbSequenceHeader)
  317.  
  318. // do not use
  319. #define MPEG1_SEQUENCE_INFO(pv) ((const BYTE *)(pv)->bSequenceHeader)
  320.  
  321. // use this macro instead, the previous only works for MPEG1VIDEOINFO structures
  322. #define MPEG2_SEQUENCE_INFO(pv) ((const BYTE *)(pv)->dwSequenceHeader)
  323.  
  324.  
  325. //===================================================================================
  326. // flags for dwTypeSpecificFlags in AM_SAMPLE2_PROPERTIES which define type specific
  327. // data in IMediaSample2
  328. //===================================================================================
  329.  
  330. #define AM_VIDEO_FLAG_FIELD_MASK        0x0003L // use this mask to check whether the sample is field1 or field2 or frame
  331. #define AM_VIDEO_FLAG_INTERLEAVED_FRAME 0x0000L // the sample is a frame (remember to use AM_VIDEO_FLAG_FIELD_MASK when using this)
  332. #define AM_VIDEO_FLAG_FIELD1            0x0001L // the sample is field1 (remember to use AM_VIDEO_FLAG_FIELD_MASK when using this)
  333. #define AM_VIDEO_FLAG_FIELD2            0x0002L // the sample is the field2 (remember to use AM_VIDEO_FLAG_FIELD_MASK when using this)
  334. #define AM_VIDEO_FLAG_FIELD1FIRST       0x0004L // if set means display field1 first, else display field2 first.
  335.                                                 // this bit is irrelavant for 1FieldPerSample mode
  336. #define AM_VIDEO_FLAG_WEAVE             0x0008L // if set use bob display mode else weave
  337. #define AM_VIDEO_FLAG_IPB_MASK          0x0030L // use this mask to check whether the sample is I, P or B
  338. #define AM_VIDEO_FLAG_I_SAMPLE          0x0000L // I Sample (remember to use AM_VIDEO_FLAG_IPB_MASK when using this)
  339. #define AM_VIDEO_FLAG_P_SAMPLE          0x0010L // P Sample (remember to use AM_VIDEO_FLAG_IPB_MASK when using this)
  340. #define AM_VIDEO_FLAG_B_SAMPLE          0x0020L // B Sample (remember to use AM_VIDEO_FLAG_IPB_MASK when using this)
  341. #define AM_VIDEO_FLAG_REPEAT_FIELD      0x0040L // if set means display the field which has been displayed first again after displaying 
  342.                                                 // both fields first. This bit is irrelavant for 1FieldPerSample mode
  343.  
  344. // -----------------------------------------------------------------------
  345. // AM_KSPROPSETID_DvdKaraoke property set definitions
  346. // -----------------------------------------------------------------------
  347.  
  348. typedef struct tagAM_DvdKaraokeData
  349. {
  350.     DWORD   dwDownmix;              // bitwise OR of AM_DvdKaraoke_Downmix flags
  351.     DWORD   dwSpeakerAssignment;    // AM_DvdKaraoke_SpeakerAssignment
  352. } AM_DvdKaraokeData;
  353.  
  354. typedef enum {
  355.     AM_PROPERTY_DVDKARAOKE_ENABLE = 0,  // BOOL
  356.     AM_PROPERTY_DVDKARAOKE_DATA = 1,
  357. } AM_PROPERTY_DVDKARAOKE;
  358.  
  359. // -----------------------------------------------------------------------
  360. // AM_KSPROPSETID_TSRateChange property set definitions for time stamp
  361. // rate changes.
  362. // -----------------------------------------------------------------------
  363.  
  364. typedef enum {
  365.     AM_RATE_SimpleRateChange = 1,    // rw, use AM_SimpleRateChange
  366.     AM_RATE_ExactRateChange  = 2,     // rw, use AM_ExactRateChange
  367.     AM_RATE_MaxFullDataRate  = 3,     // r,  use AM_MaxFullDataRate
  368.     AM_RATE_Step             = 4     // w,  use AM_Step
  369. } AM_PROPERTY_TS_RATE_CHANGE;
  370.  
  371. // -------------------------------------------------------------------
  372. // AM_KSPROPSETID_DVD_RateChange property set definitions for new DVD
  373. // rate change scheme.
  374. // -------------------------------------------------------------------
  375.  
  376. typedef enum {
  377.     AM_RATE_ChangeRate       = 1,    // w,  use AM_DVD_ChangeRate
  378.     AM_RATE_FullDataRateMax  = 2,     // r,  use AM_MaxFullDataRate
  379.     AM_RATE_ReverseDecode    = 3,    // r,  use LONG
  380.     AM_RATE_DecoderPosition  = 4,    // r,  use AM_DVD_DecoderPosition
  381.     AM_RATE_DecoderVersion   = 5     // r,  use LONG
  382. } AM_PROPERTY_DVD_RATE_CHANGE;
  383.  
  384. typedef struct {
  385.     // this is the simplest mechanism to set a time stamp rate change on
  386.     // a filter (simplest for the person setting the rate change, harder
  387.     // for the filter doing the rate change).  
  388.     REFERENCE_TIME    StartTime;  //stream time at which to start this rate
  389.     LONG        Rate;       //new rate * 10000 (decimal)
  390. } AM_SimpleRateChange;
  391.  
  392. typedef struct {
  393.     REFERENCE_TIME  OutputZeroTime; //input TS that maps to zero output TS
  394.     LONG        Rate;       //new rate * 10000 (decimal)
  395. } AM_ExactRateChange;
  396.  
  397. typedef LONG AM_MaxFullDataRate; //rate * 10000 (decimal)
  398.  
  399. typedef DWORD AM_Step; // number of frame to step
  400.  
  401. // New rate change property set, structs. enums etc.
  402. typedef struct {
  403.     REFERENCE_TIME    StartInTime;   // stream time (input) at which to start decoding at this rate
  404.     REFERENCE_TIME    StartOutTime;  // reference time (output) at which to start showing at this rate
  405.     LONG            Rate;          // new rate * 10000 (decimal)
  406. } AM_DVD_ChangeRate ;
  407.  
  408. typedef LONGLONG  AM_DVD_DecoderPosition ;
  409.  
  410. typedef enum {
  411.     DVD_DIR_FORWARD  = 0,
  412.     DVD_DIR_BACKWARD = 1
  413. } DVD_PLAY_DIRECTION ;
  414.  
  415. #ifdef __cplusplus
  416. }
  417. #endif // __cplusplus
  418. #endif // __DVDMEDIA_H__
  419.